package com.tz.example;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * Hello world!
 */
public class App {
    public static void main(String[] args) throws Exception {
        System.out.println("Hello World!");
        //反射破解简饿汉式单例模式
        Runtime runtime = Runtime.getRuntime();
        Constructor<Runtime> declaredConstructor = Runtime.class.getDeclaredConstructor(null);
        declaredConstructor.setAccessible(true);
        Runtime runtime1 = declaredConstructor.newInstance();
        System.out.println(runtime);
        System.out.println(runtime1);

    }
}
